import request from '@/utils/request'
export function fetchList(params) {
  return request({
    url:'/home/advertise/list',
    method:'get',
    params:params
  })
}
export function updateStatus(id,params) {
  return request({
    url:'/home/advertise/update/status/'+id,
    method:'post',
    params:params
  })
}
export function deleteHomeAdvertise(data) {
  return request({
    url:'/home/advertise/delete',
    method:'post',
    data:data
  })
}
export function createHomeAdvertise(data) {
  return request({
    url:'/home/advertise/create',
    method:'post',
    data:data
  })
}
export function getHomeAdvertise(id) {
  return request({
    url:'/home/advertise/'+id,
    method:'get',
  })
}

export function updateHomeAdvertise(id,data) {
  return request({
    url:'/home/advertise/update/'+id,
    method:'post',
    data:data
  })
}

//获取某resource下关联的商品列表
export function fetchRelatedProductList(rid) {
  return request({
    url:'/home/advertise/relation/detail/'+rid,
    method:'get',
    // params:{rid:rid}
  })
}
//某resource新增关联商品
export function updateRelatedProduct(data) {
  return request({
  url:'/home/advertise/relation/upsert',
  method:'post',
  data:data
  })
}
//删除某resource的某个关联商品
export function delRelatedProductList(delids) {
  return request({
    url:'/home/advertise/relation/del',//+aid,
    method:'post',
    // data:{'pids':delids}
    data:delids
  })
}